package com.zhu.esyblog.controller;


import com.zhu.esyblog.pojo.RespBean;
import com.zhu.esyblog.service.ICommentService;
import com.zhu.esyblog.vo.CommentParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author stx
 * @since 2022-06-22
 */
@RestController
@RequestMapping("/comments")
@Api(tags = "文章评论模块")
public class CommentController {
    @Autowired
    private ICommentService commentService;
    @ApiOperation(value = "文章评论列表")
    @PostMapping("article/{id}")
    public RespBean comments(@PathVariable("id")Long id){
          return commentService.commentsByArticleId(id);
    }


    @ApiOperation(value = "评论文章")
    @PostMapping("create/change")
    public RespBean comments(@RequestBody CommentParam commentParam){
        return commentService.comment(commentParam);
    }
}
